package com.evan.produce;

/**
 * @author huangzhongliang
 * @time 2023/06/06 19:53
 */
public class TicketThread {

    //3个人卖30张票 不出现超卖
    private int ticketNum = 30;

    public synchronized void saleTicket() {
        if (ticketNum > 0) {
            System.out.println(Thread.currentThread().getName() + "卖出时数量:" + (ticketNum--) + "剩下:" + ticketNum);
        }
    }
}
